import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common';
import { UserService } from './user.service';
import { UserController } from './user.controller';
import { GetPathUrl } from 'src/middleware/userLogger';
import { createClient } from 'redis';

@Module({
  controllers: [UserController],
  providers: [
    UserService,
    {
      provide: 'userList',
      useValue: ['kobe', 'james', 'curry', 'durant']
    }
  ],
})
export class UserModule implements NestModule{
  configure (consumer: MiddlewareConsumer) {
    // 给 user 模块加局部中间件
    consumer.apply(GetPathUrl).forRoutes('user')
  }
}

